package com.zhongkai.Bean;

import com.mysql.jdbc.StringUtils;

public class ErrorCodeBean {

    private final static char ERR01 = 1;
    private final static char ERR02 = 2;
    private final static char ERR03 = 3;
    private final static char ERR04 = 4;
    private final static char ERR05 = 5;
    private final static char ERR06 = 6;
    private final static char ERR07 = 7;
    private final static char ERR08 = 8;
    private final static char ERR09 = 9;
    private final static char ERR10 = 10;
    private final static char ERR11 = 11;
    private final static char ERR12 = 12;
    private final static char ERR13 = 13;
    private final static char ERR14 = 14;
    private final static char ERR15 = 15;
    private final static char ERR16 = 16;
    private final static char ERR17 = 17;
    private final static char ERR18 = 18;
    private final static char ERR19 = 19;
    private final static char ERR20 = 20;
    private final static char ERR21 = 21;
    private final static char ERR22 = 22;
    private final static char ERR23 = 23;
    private final static char ERR24 = 24;
    private final static char ERR25 = 25;
    private final static char ERR26 = 26;


    private final static String ERR01_DES = "用户侧水流开关错误;";

    private final static String ERR02_DES = "地源侧水流开关错误;";

    private final static String ERR03_DES = "压缩机排气开关错误 ;";

    private final static String ERR04_DES = "压缩机吸气开关错误;";

    private final static String ERR05_DES = "压缩机排气温度过高开关错误;";

    private final static String ERR06_DES = "四通阀高开关错误;";

    private final static String ERR07_DES = "系统电压过低错误;";

    private final static String ERR08_DES = "系统电压过高错误;";

    private final static String ERR09_DES = "用户侧进水压力传感器错误;";

    private final static String ERR10_DES = "用户侧出水压力传感器错误;";

    private final static String ERR11_DES = "地源侧进水压力传感器错误;";

    private final static String ERR12_DES = "地源侧出水压力传感器错误;";

    private final static String ERR13_DES = " 系统补水压力传感器错误;";

    private final static String ERR14_DES = "用户侧进水温度传感器错误;";

    private final static String ERR15_DES = "用户侧出水温度传感器错误;";

    private final static String ERR16_DES = "地源侧进水温度传感器错误;";

    private final static String ERR17_DES = "地源侧出水温度传感器错误;";

    private final static String ERR18_DES = "环境温度传感器错误;";

    private final static String ERR19_DES = "压缩机吸气温度传感器错误;";

    private final static String ERR20_DES = "压缩机排气温度传感器错误;";

    private final static String ERR21_DES = "用户侧循环泵故障;";

    private final static String ERR22_DES = "地源侧循环泵故障;";

    private final static String ERR23_DES = "地源侧进水温度太低故障;";

    private final static String ERR24_DES = "地源侧出水温度太低故障;";

    private final static String ERR25_DES = "地源侧进出水温度温差太大故障;";

    private final static String ERR26_DES = "用户侧进出水温度温差太大故障;";

    private final static String ERR_DES = "未知错误;";




    public  static String err_code(String code) {
        StringBuffer buffer = new StringBuffer();
        buffer.setLength(0);
        String[] split = code.split(",");

        for (String s : split) {
                if (s == "" || StringUtils.isNullOrEmpty(s)){

                }else {
                    buffer.append(err_des(Integer.valueOf(s)));

                }

        }

        return buffer.toString();
    }


    public  static String err_code2(String code) {
        StringBuffer buffer = new StringBuffer();

        buffer.setLength(0);
        String[] split = code.split("#");

        for (String s : split) {
            if (s == "" || StringUtils.isNullOrEmpty(s)){

            }else {
                buffer.append(err_des(Integer.valueOf(s)));

            }

        }

        return buffer.toString();
    }


    public final static String err_des(int code) {

        switch (code) {
            case ERR01:
                return ERR01_DES;

            case ERR02:
                return ERR02_DES;

            case ERR03:
                return ERR03_DES;

            case ERR04:
                return ERR04_DES;

            case ERR05:
                return ERR05_DES;

            case ERR06:
                return ERR06_DES;

            case ERR07:
                return ERR07_DES;

            case ERR08:
                return ERR08_DES;

            case ERR09:
                return ERR09_DES;

            case ERR10:
                return ERR10_DES;

            case ERR11:
                return ERR11_DES;

            case ERR12:
                return ERR12_DES;

            case ERR13:
                return ERR13_DES;

            case ERR14:
                return ERR14_DES;

            case ERR15:
                return ERR15_DES;

            case ERR16:
                return ERR16_DES;

            case ERR17:
                return ERR17_DES;

            case ERR18:
                return ERR18_DES;

            case ERR19:
                return ERR19_DES;

            case ERR20:
                return ERR20_DES;

            case ERR21:
                return ERR21_DES;

            case ERR22:
                return ERR22_DES;

            case ERR23:
                return ERR23_DES;

            case ERR24:
                return ERR24_DES;

            case ERR25:
                return ERR25_DES;

            case ERR26:
                return ERR26_DES;

            default:

                return ERR_DES;


        }
    }
}
